Should I use a Monad or a Comonad ?

نویسنده

  • Dominic Orchard
چکیده

The category theoretic structures of monads and comonads can be used as an abstraction mechanism for simplifying both language semantics and programs. Monads have been used to structure impure computations, whilst comonads have been used to structure context-dependent computations. Interestingly, the class of computations structured by monads and the class of computations structured by comonads are not mutually exclusive. This paper formalises and explores the conditions under which a monad and a comonad can both structure the same notion of computation: when a comonad is left adjoint to a monad. Furthermore, we examine situations where a particular monad/comonad model of computation is deficient in capturing the essence of a computational pattern and provide a technique for calculating an alternative monad or comonad structure which fully captures the essence of the computation. Included is some discussion on how to choose between a monad or comonad structure in the case where either can be used to capture a particular notion of computation.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Patterns for computational effects arising from a monad or a comonad

This paper presents equational-based logics for proving first order properties of programming languages involving effects. We propose two dual inference system patterns that can be instanciated with monads or comonads in order to be used for proving properties of different effects. The first pattern provides inference rules which can be interpreted in the Kleisli category of a monad and the coK...

متن کامل

Algebraic Weak Factorisation Systems I: Accessible Awfs

Algebraic weak factorisation systems (awfs) refine weak factorisation systems by requiring that the assignations sending a map to its first and second factors should underlie an interacting comonad–monad pair on the arrow category. We provide a comprehensive treatment of the basic theory of awfs—drawing on work of previous authors—and complete the theory with two main new results. The first pro...

متن کامل

Coalgebraic semantics for timed processes

We give a coalgebraic formulation of timed processes and their operational semantics. We model time by a monoid called a “time domain”, and we model processes by “timed transition systems”, which amount to partial monoid actions of the time domain or, equivalently, coalgebras for an “evolution comonad” generated by the time domain. All our examples of time domains satisfy a partial closure prop...

متن کامل

Galois Functors and Entwining Structures

Galois comodules over a coring can be characterised by properties of the relative injective comodules. They motivated the definition of Galois functors over some comonad (or monad) on any category and in the first section of the present paper we investigate the role of the relative injectives (projectives) in this context. Then we generalise the notion of corings (derived from an entwining of a...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2012